package model;

import java.util.Observable;

/**
 * 
 * @author Michael & Pierre
 *
 */
/**
 * Model observable used to manage the sharing of messages
 */
public class SharingMessages extends Observable{
	
	/**
	 * true if the message will be sent by the local system, false if the message comes from a remote application
	 */
	boolean toSend; //false if rcvd msg
	/**
	 * Text of the message
	 */
	String text;
	User user;
	
	/**
	 * Method calles when a message has been received or when the local user wants to send a message
	 * @param toSend true if the message will be sent by the local system, false if the message comes from a remote application
	 * @param msg Text of the message
	 * @param user remote user
	 */
	public void newMessage(boolean toSend, String msg, User user) {
		this.toSend = toSend;
		text = msg;
		this.user = user;
		setChanged();
		notifyObservers();
	}

	public boolean isToSend() {
		return toSend;
	}

	public String getText() {
		return text;
	}

	public User getUser() {
		return user;
	}
	
	
	
}
